package com.minyon_web_admin.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.minyon_web_admin.common.base.BaseController;
import com.minyon_web_admin.common.bean.AjaxResponseBean;
import com.minyon_web_admin.common.bean.DataTablesBean;
import com.minyon_web_admin.model.SysLogBean;
import com.minyon_web_admin.server.ISysLog;
/**
 * 
 * <br>
 * <b>功能：</b>SysLogController<br>
 * <br>
 *  @author wwy
 */ 
@Controller
@RequestMapping("/sys/syslog")
public class SysLogController extends BaseController{
 
	@Autowired(required=false) 
	private ISysLog  sysLogService; 
	
	
 
	/**
	 * 列表页.
	 * 
	 * @return
	 * ModelAndView
	 */
	//@RequiresPermissions(PermissionCode.BMS_CRDRECORD_LIST)
	@RequestMapping(value = "/list.shtml", method = RequestMethod.GET)
	public String list(Model model) {
		return "sysLog/list";
		
	}
     /**
	 * 查询分页菜单列表.
	 * @return
	 * @param reqMap
	 * @return
	 * DataTablesBean
	 */
	@RequestMapping("/ajaxGetListPage.shtml")
	@ResponseBody
	public DataTablesBean  ajaxGetListPage(@RequestBody Map<String,Object> reqMap) {
		DataTablesBean info= getAjaxDataTablesBeanResultMap(sysLogService.getListPage(reqMap));
		return info;
	}
	/**
	 * 返回列表页.
	 *  @param
	 * @return
	 * ModelAndView
	 */
	public String  goListPage(){
		return "redirect:SysLog/list";
	}
	/**
	 * 删除数据.
	 * @param id
	 * @return
	 * ajaxResult
	 */
	 @RequestMapping("/ajaxDelete.shtml")
	 @ResponseBody
     public AjaxResponseBean  ajaxDelete(String id) {
	     AjaxResponseBean result=getAjaxResultMap(sysLogService.deleteInfo(id),false);
		 return  result;
	}

	/**
	 * 新增数据页面请求.
	 * @param id
	 * @return
	 * ModelAndView
	 */
	//@RequiresPermissions(PermissionCode.BMS_CRDRECORD_LIST)
    @RequestMapping(value = "/addInfo.shtml", method = RequestMethod.GET)
	public String addInfo(Model model,HttpServletRequest request) {
		return "sysLog/add";
	}
	
	/**
	 * ajax新增数据保存.
	 * @param id
	 * @return
	 * ModelAndView
	 */
    @RequestMapping(value = "/ajaxAddInfo.shtml", method = RequestMethod.POST)
	@ResponseBody
	public AjaxResponseBean ajaxSaveAddInfo(Model model,@RequestBody SysLogBean bean) {
	 AjaxResponseBean result=getAjaxResultMap(sysLogService.insertInfo(bean),false);
	 return result;
	}
	/**
	 * 修改数据页面请求.
	 * @param id
	 * @return
	 * ModelAndView
	 */
	//@RequiresPermissions(PermissionCode.*)
    @RequestMapping(value = "/updateInfo.shtml", method = RequestMethod.GET)
	public String updateInfo(Model model,String id,HttpServletRequest request) {
	Map<String,Object> reqMap =new HashMap<String,Object>();
	    SysLogBean bean=getResultMap(sysLogService.queryDetail(reqMap),false);
	     model.addAttribute("updateInfo",bean);
		return "sysLog/update";
	}
	 /**
	 * ajax修改数据.
	 * @param id
	 * @return
	 * ajaxResult
	 */
	 @RequestMapping("/ajaxUpdate.shtml")
	 @ResponseBody
     public AjaxResponseBean  ajaxUpdate(@RequestBody SysLogBean bean) {
	     AjaxResponseBean result=getAjaxResultMap(sysLogService.updateInfo(bean),false);
		 return  result;
	}
	/**
	 * 详细信息请求.
	 * @param id
	 * @param model
	 * @return 详情页面
	 */
	@RequestMapping(value = "/detail.shtml", method = RequestMethod.GET)
	//@RequiresPermissions(PermissionCode.BMS_CRDRECORD_LIST)
	public String detail(Model model,Map<String,Object> reqMap){
	SysLogBean bean=getResultMap(sysLogService.queryDetail(reqMap),false);
	     model.addAttribute("detailInfo",bean);
		return "sysLog/detail";
	}
}
